/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
using System;
using System.Collections.Generic;

using Aliyun.Acs.Core.Transform;
using Aliyun.Acs.Ccs.Model.V20171001;

namespace Aliyun.Acs.Ccs.Transform.V20171001
{
    public class QueryTicketResponseUnmarshaller
    {
        public static QueryTicketResponse Unmarshall(UnmarshallerContext context)
        {
			QueryTicketResponse queryTicketResponse = new QueryTicketResponse();

			queryTicketResponse.HttpResponse = context.HttpResponse;
			queryTicketResponse.RequestId = context.StringValue("QueryTicket.RequestId");
			queryTicketResponse.PageNum = context.IntegerValue("QueryTicket.PageNum");
			queryTicketResponse.PageSize = context.IntegerValue("QueryTicket.PageSize");
			queryTicketResponse.TotalCount = context.LongValue("QueryTicket.TotalCount");

			List<QueryTicketResponse.QueryTicket_Ticket> queryTicketResponse_tickets = new List<QueryTicketResponse.QueryTicket_Ticket>();
			for (int i = 0; i < context.Length("QueryTicket.Tickets.Length"); i++) {
				QueryTicketResponse.QueryTicket_Ticket ticket = new QueryTicketResponse.QueryTicket_Ticket();
				ticket.Id = context.StringValue("QueryTicket.Tickets["+ i +"].Id");
				ticket.Type = context.StringValue("QueryTicket.Tickets["+ i +"].Type");
				ticket.Stage = context.StringValue("QueryTicket.Tickets["+ i +"].Stage");
				ticket.Description = context.StringValue("QueryTicket.Tickets["+ i +"].Description");
				ticket.CreatorId = context.StringValue("QueryTicket.Tickets["+ i +"].CreatorId");
				ticket.CreateTime = context.StringValue("QueryTicket.Tickets["+ i +"].CreateTime");
				ticket.CustomFields = context.StringValue("QueryTicket.Tickets["+ i +"].CustomFields");

				queryTicketResponse_tickets.Add(ticket);
			}
			queryTicketResponse.Tickets = queryTicketResponse_tickets;
        
			return queryTicketResponse;
        }
    }
}
